package com.example.utilcenter.updateTip;

import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.utilcenter.R;

public class updateTip {


    public void getUpdateInfo(Context context, String newVersion, String newContent, final View.OnClickListener clickListener) {

        View view = LayoutInflater.from(context).inflate(R.layout.updata_view, null);
        final AlertDialog dialog = new AlertDialog.Builder(context).setView(view).show();
        TextView content = (TextView) view.findViewById(R.id.content);
        TextView number = (TextView) view.findViewById(R.id.number);
        Button now = (Button) view.findViewById(R.id.now);
        Button later = (Button) view.findViewById(R.id.later);
        now.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                clickListener.onClick(v);
                dialog.dismiss();

            }
        });
        later.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        content.setText(newContent);
        number.setText(newVersion);

    }


}
